export default {
    mounted() {
        // 监听回车
        window.addEventListener("keyup", e => {
            if (e.keyCode == 13&&this.onSearch) {
                this.onSearch();
            }
        });

        // 监听列表滚动
        this.$refs.table.bodyWrapper.addEventListener('scroll', res => {
            this.scrollTop = res.target.scrollTop
        })

        // 获取列表最大的高度
        this.$nextTick(function () {
            this.maxHeight = window.innerHeight - this.$refs.tableRow.$el.offsetTop - 50;
            window.onresize = () => {
                this.maxHeight = window.innerHeight - this.$refs.tableRow.$el.offsetTop - 50;
            }
        })
    },
    activated() {
        // this.$nextTick(()=>{
        // setTimeout(()=>{
        if (!this.$route.params.list) {
            const el = this.$refs.table.$el.querySelector('.el-table__body-wrapper')
            el.scrollTop = this.scrollTop
        }
        // },130)
        // })
    },
    destroyed() {
        window.removeEventListener("keydown", this.keyDown, false);
    },
}